﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Easyui扩展库 validatebox - 落阳 整理</title>
    <link href="http://www.easyui-extlib.com/Content/Site.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery/jquery-1.11.0.min.js"></script>
    <script src="http://www.easyui-extlib.com/Scripts/jquery-extensions/jquery.jdirk.js"></script>
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/themes/default/easyui.css" rel="stylesheet" />
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js"></script>

    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/validatebox/jeasyui.extensions.validatebox.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/validatebox/jeasyui.extensions.validatebox.rules.remote.js"></script>
    <script>
        $(function () {

            $("#vTarget1").validatebox({
                validType: ['remoteValidWithoutField["用户名","/Validatebox/CheckUserNameExist"]']
            });

            $("#vTarget2").validatebox({
                validType: ['remoteValidWithoutField["用户名","/Validatebox/CheckUserNameExist","2"]']
                //也可以这样调用
                //validType: ['remoteValidWithoutField["用户名","/Validatebox/CheckUserNameExist","2","string"]']
            });
        });
    </script>
</head>
<body>
    <div class="easyui-panel" data-options="fit:true,border:false" style="padding:20px;">

        <input id="vTarget1" type="text" value="" /> &nbsp;<span>该控件用于判定新增时用户名是否重复</span>
        <br />
        <br /><br />
        <input id="vTarget2" type="text" value="seven" /> &nbsp;<span>该控件用于判定编辑[id为2]的用户信息时用户名是否重复</span>
        <br />
        <br /><br />
        <span style="color:red;">后台中已经存在以下数据：</span>
        <p>ID: 1   UserName: admin</p>
        <p>ID: 2   UserName: seven</p>
        <p>ID: 3   UserName: easyui</p>
        <p>ID: 4   UserName: extlib</p>

        <hr />
        说明：该功能由于牵涉到后台，因此本demo只是提供“代码如何写”，不提供具体功能（因为访问不到Url）。
    </div>
</body>
</html>
